package cn.hls.entity;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

/**
 * 
 * @fileName: Org.java
 * @package: com.bangni.dao
 * @Description: 机构管理实体类
 * @author: yinghui.zhang
 * @email: uuhui@163.com
 * @date: 2015-5-1
 */
@Table(name = "T_ORG")
@Entity
@DynamicInsert
@DynamicUpdate
public class Org extends BaseEntity {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String name;// 机构名称
	private String code;// 机构代码
	private Integer sort;// 序号
	private Org parent;// 上级机构
	private String leader;// 负责人
	private String phone;// 联系电话
	private String remark;// 说明
	public Org() {

	}

	public Org(Long id) {
		super(id);
	}

	public Org(Long id, String name) {
		super(id);
		this.name = name;
	}

	public Org(Long id,String name,String leader,String phone){
		super(id);
		this.name=name;
		this.leader=leader;
		this.phone=phone;
	}
	@Column(name = "name", length = 32, nullable = false)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "code", length = 16, nullable = false)
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@Column(name = "sort", columnDefinition = "integer default 1")
	public Integer getSort() {
		return sort;
	}

	public void setSort(Integer sort) {
		this.sort = sort;
	}

	@ManyToOne(cascade = CascadeType.REFRESH)
	@NotFound(action = NotFoundAction.IGNORE)
	@JoinColumn(name = "P_ID")
	public Org getParent() {
		return parent;
	}

	public void setParent(Org parent) {
		this.parent = parent;
	}

	@Column(name = "remark", length = 100)
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(name = "leader", length = 32)
	public String getLeader() {
		return leader;
	}

	public void setLeader(String leader) {
		this.leader = leader;
	}



	@Column(name = "phone", length = 16)
	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}


}
